<?php
/**
 * @Author:      ZH
 * @DateTime:  2017-07-13 13:38:30
 * @Description: 金蝶数据
 */
class JinDieFAccountItemInfo extends Eloquent
{
    protected $table = "FAccountItemInfo";

    //写入数据库
    public static function storeDataQuery($result){
        foreach($result as $val) {
            $JinDieFAccountItemInfo= JinDieFAccountItemInfo::where('FNumber',$val->FNumber)->orderBy('updated_at','desc')->first();
            if(!$JinDieFAccountItemInfo){
                $JinDieFAccountItemInfo = new JinDieFAccountItemInfo();
                $JinDieFAccountItemInfo->created_at = Common::currentTimeString();
            }
            $JinDieFAccountItemInfo->FPNumber = $val->FPNumber;
            $JinDieFAccountItemInfo->FPName = $val->FPName;
            $JinDieFAccountItemInfo->FNumber = $val->FNumber;
            $JinDieFAccountItemInfo->FName = $val->FName;
            $JinDieFAccountItemInfo->FPhone = $val->FPhone;
            try {
                $JinDieFAccountItemInfo->save();
            }catch(Exception $e){

            }
        }
    }
}